package gui.items;


import gui.fenetrage.GUIFenetrePrincipale;
import gui.panels.Planche;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;

public class ActionBoutonCalcul implements ActionListener {

	OperationAction opac;
	ActionListener actlist;
	Planche planche;

	public ActionBoutonCalcul(OperationAction opac, ActionListener actlist, Planche planche) {
		this.opac = opac;
		this.actlist = actlist;
		this.planche = planche;
	}

	public void actionPerformed(ActionEvent e) {
		if (planche.estValide()) {
			actlist.actionPerformed(e);
			opac.execute();
		}
		else {
			JOptionPane.showMessageDialog(GUIFenetrePrincipale.getInstance(), "Il manque des informations", "Information", JOptionPane.ERROR_MESSAGE);
		}
	}

}
